/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.kliento.panels;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.EtchedBorder;

/**
 *
 * @author athos
 */
public class ClientsPanel extends JPanel
{
    

    private Dimension dimension = new Dimension(100, 36);
    private Dimension dimension2 = new Dimension(100, 50);
    private Dimension dimension3 = new Dimension(80, 20);
    private JPanel downPanel = new JPanel(new GridBagLayout()); 
    
    //Componentes do painel superior
    
    private JPanel topPanel = new JPanel(new GridBagLayout());
    private JButton bNew = new JButton("Novo");
    private JButton bEdit = new JButton("Editar");
    private JButton bDelete = new JButton("Deletar");
    private JButton bPrint = new JButton("Imprimir");
    private JButton bReport = new JButton("Relatório");
    
    //Componentes do painel esquerdo
    
    private JPanel leftPanel = new JPanel(new GridBagLayout());
    private JButton bClients = new JButton("Clientes");
    private JButton bContacts = new JButton("Contatos");
    private JButton bAgenda = new JButton("Agenda");
    private JButton bMessages = new JButton("Mensagens");
    private JButton bUsers = new JButton("Usuários");
    
    //Componentes do Painel Principal
    
    private JPanel formPanel = new JPanel(new GridBagLayout());
    private JTextField tname = new JTextField();
    private JLabel lname = new JLabel("Nome");
    private JTextField tcnpj = new JTextField();
    private JLabel lcnpj = new JLabel("CPF/CNPJ");
    private JComboBox cstatus = new JComboBox();
    private JLabel lstatus = new JLabel("Status");
    private JComboBox ctype = new JComboBox();
    private JLabel ltype = new JLabel("Tipo");
    private JComboBox cgenre = new JComboBox();
    private JLabel lgenre = new JLabel("Negócio");
    private JButton bfind = new JButton("Consulta");
    private JSeparator sseparator = new JSeparator(SwingConstants.HORIZONTAL);
    private JTable tregisters = new JTable();    


    public ClientsPanel()
    {
        setLayout(new GridBagLayout());
        initComps();
    }
    
    public void initComps()
    {
        //Inicialização e ajuste de layout do painel superior
        
        bNew.setMinimumSize(dimension);
        bNew.setMaximumSize(dimension);
        bNew.setPreferredSize(dimension);
        topPanel.add(bNew, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 
                GridBagConstraints.WEST, GridBagConstraints.NONE,
                new Insets(5, 5, 5, 5), 0, 0));
        
        bEdit.setMinimumSize(dimension);
        bEdit.setMaximumSize(dimension);
        bEdit.setPreferredSize(dimension);
        topPanel.add(bEdit, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, 
                GridBagConstraints.WEST,  GridBagConstraints.NONE,
                new Insets(5, 5, 5, 5), 0, 0));
        
        bDelete.setMinimumSize(dimension);
        bDelete.setMaximumSize(dimension);
        bDelete.setPreferredSize(dimension);
        topPanel.add(bDelete, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, 
                GridBagConstraints.WEST, GridBagConstraints.NONE,
                new Insets(5, 5, 5, 5), 0, 0));
        
        bPrint.setMinimumSize(dimension);
        bPrint.setMaximumSize(dimension);
        bPrint.setPreferredSize(dimension);
        topPanel.add(bPrint, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, 
                GridBagConstraints.WEST, GridBagConstraints.NONE,
                new Insets(5, 5, 5, 5), 0, 0));
        
        bReport.setMinimumSize(dimension);
        bReport.setMaximumSize(dimension);
        bReport.setPreferredSize(dimension);
        topPanel.add(bReport, new GridBagConstraints(4, 0, 1, 1, 1.0, 0.0, 
                GridBagConstraints.WEST, GridBagConstraints.NONE,
                new Insets(5, 5, 5, 5), 0, 0));
        
        topPanel.setBorder(new EtchedBorder());
        add(topPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 0.0,
                GridBagConstraints.FIRST_LINE_START,
                GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0));
       
        
        //Inicialização e ajuste de layout do painel esquerdo
        
        bClients.setMinimumSize(dimension2);
        bClients.setMaximumSize(dimension2);
        bClients.setPreferredSize(dimension2);
        leftPanel.add(bClients, new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, 
                GridBagConstraints.FIRST_LINE_START, GridBagConstraints.NONE,
                new Insets(5, 5, 5, 5), 0, 0));
        
        bContacts.setMinimumSize(dimension2);
        bContacts.setMaximumSize(dimension2);
        bContacts.setPreferredSize(dimension2);
        leftPanel.add(bContacts, new GridBagConstraints(0, 1, 1, 1, 0.0, 1.0, 
                GridBagConstraints.FIRST_LINE_START, GridBagConstraints.NONE,
                new Insets(5, 5, 5, 5), 0, 0));
        
        bAgenda.setMinimumSize(dimension2);
        bAgenda.setMaximumSize(dimension2);
        bAgenda.setPreferredSize(dimension2);
        leftPanel.add(bAgenda, new GridBagConstraints(0, 2, 1, 1, 0.0, 1.0, 
                GridBagConstraints.NORTH, GridBagConstraints.NONE,
                new Insets(5, 5, 5, 5), 0, 0));
        
        bMessages.setMinimumSize(dimension2);
        bMessages.setMaximumSize(dimension2);
        bMessages.setPreferredSize(dimension2);
        leftPanel.add(bMessages, new GridBagConstraints(0, 3, 1, 1, 0.0, 1.0, 
                GridBagConstraints.NORTH, GridBagConstraints.NONE,
                new Insets(5, 5, 5, 5), 0, 0));
        
        bUsers.setMinimumSize(dimension2);
        bUsers.setMaximumSize(dimension2);
        bUsers.setPreferredSize(dimension2);
        leftPanel.add(bUsers, new GridBagConstraints(0, 4, 1, 1, 0.0, 1.0, 
                GridBagConstraints.NORTH, GridBagConstraints.NONE,
                new Insets(5, 5, 5, 5), 0, 0));
        
        leftPanel.setBorder(new EtchedBorder());
        downPanel.add(leftPanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0,
                GridBagConstraints.EAST,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
        
        //Inicialização e ajuste de layout do painel principal
        
        formPanel.add(lname, new GridBagConstraints(0, 0, 1, 1, 0, 0,
                GridBagConstraints.WEST,
                GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
        
        formPanel.add(tname, new GridBagConstraints(1, 0, 1, 1, 1, 1,
                GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
        
        formPanel.add(ltype, new GridBagConstraints(2, 0, 1, 1, 0, 0,
                GridBagConstraints.WEST,
                GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
        
        formPanel.add(ctype, new GridBagConstraints(3, 0, 1, 1, 1, 1,
                GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
        
        formPanel.add(lcnpj, new GridBagConstraints(4, 0, 1, 1, 0, 0,
                GridBagConstraints.WEST,
                GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
        
        formPanel.add(tcnpj, new GridBagConstraints(5, 0, 1, 1, 1, 1,
                GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
        
        formPanel.add(lstatus, new GridBagConstraints(0, 1, 1, 1, 0, 0,
                GridBagConstraints.WEST,
                GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
        
        formPanel.add(cstatus, new GridBagConstraints(1, 1, 1, 1, 1, 1,
                GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));

        formPanel.add(lgenre, new GridBagConstraints(2, 1, 1, 1, 0, 0,
                GridBagConstraints.WEST,
                GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
        
        formPanel.add(cgenre, new GridBagConstraints(3, 1, 1, 1, 1, 1,
                GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
        
        formPanel.add(bfind, new GridBagConstraints(4, 1, 1, 1, 1, 1,
                GridBagConstraints.EAST,
                GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
        
        formPanel.add(sseparator, new GridBagConstraints(0, 2, 4, 1, 2, 2,
                GridBagConstraints.NORTH,
                GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
        
        formPanel.add(tregisters, new GridBagConstraints(0, 3, 6, 6, 3, 3,
                GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
        
        formPanel.setBorder(new EtchedBorder());
        downPanel.add(formPanel, new GridBagConstraints(1, 0, 2, 1, 1, 1, 
                GridBagConstraints.WEST,
                GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
        
        add(downPanel, new GridBagConstraints(1, 1, 2, 1, 1, 1,
                GridBagConstraints.WEST,
                GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
        
    }
    
    
}
